package com.kili.mirco.spark_als.ref.factory;

import avro.shaded.com.google.common.base.Preconditions;
import com.kili.mirco.spark_als.ref.hanlder.RecommendProcessor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

/**
 * @date 19-6-3
 * @auther jackliang
 * @description TODO
 */

@Slf4j
public class ModelFactory extends AbstractAlogrithmFactoy {


    public RecommendProcessor getInstance(String var) {
        Preconditions.checkArgument(StringUtils.hasText(var), "Initialized class type name is not null");
        try {
            return (RecommendProcessor) super.getBean(MAIN_LOADER.loadClass(var));
        } catch (ClassNotFoundException e) {
            log.error("As such  Ljava.lang.Class is not exist .", e);
            System.exit(-1);
        }
        return null;
    }

}
